//
//  GZStatusButtonView.swift
//  sinaweibo
//
//  Created by mac book pro on 16/3/26.
//  Copyright © 2016年 finish. All rights reserved.
//

import UIKit
import SnapKit
class GZStatusButtonView: UIView {
    override init(frame: CGRect) {
        super.init(frame: frame)
        prepareUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    private func prepareUI(){
        // 添加子控件
        addSubview(forwardButton)
        addSubview(commentButton)
        addSubview(likeButton)
        addSubview(separatorViewFirst)
        addSubview(separatorViewSecond)
        
        //添加约束
        forwardButton.snp_makeConstraints { (make) -> Void in
            make.leading.top.bottom.equalTo(self)
        }
        commentButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(forwardButton.snp_trailing)
            make.top.bottom.equalTo(self)
            make.width.equalTo(forwardButton)
            
        }
        likeButton.snp_makeConstraints { (make) -> Void in
            make.top.bottom.trailing.equalTo(self)
            make.leading.equalTo(commentButton.snp_trailing)
            make.width.equalTo(forwardButton)
        }
        separatorViewFirst.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(forwardButton.snp_trailing)
            make.centerY.equalTo(forwardButton)
        }
        
        separatorViewSecond.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(commentButton.snp_trailing)
            make.centerY.equalTo(commentButton)
        }
        
    }
    // MARK: - 懒加载
    /// 转发, 使用默认参数
    private lazy var forwardButton: UIButton = UIButton(title: "转发", imageName: "timeline_icon_retweet")
    
    /// 评论
    private lazy var commentButton: UIButton = UIButton(title: "评论", imageName: "timeline_icon_comment")
    
    /// 赞
    private lazy var likeButton: UIButton = UIButton(title: "赞", imageName: "timeline_icon_unlike")
    /// 分割线1
    private lazy var separatorViewFirst: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    
    /// 分割线2
    private lazy var separatorViewSecond: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
}
